<?php
Yii::app()->clientScript->registerScript('search',
        "$('form#search_kelurahan').submit(function()
            {
                $.fn.yiiGridView.update('kelurahan-grid',{
                data:$(this).seriallize()
                });
                return false;
            });
        ");    
?>

<h1>Data Kelurahan</h1>

<?php $this->renderPartial('_search',array('model'=>$model,));?>

<?php 
$this->widget('bootstrap.widgets.TBGridView', array(
    'id' => 'kelurahana -grid',
    'dataProvider' => $model->search(),
    'type' => 'striped bordered condensed',
    'columns' => array(
        array(
            'header' => 'Kode Kelurahan',
            'name' => 'kode_kel',
        ),
        array(
            'header' => 'Nama Kelurahan',
            'name' => 'nama_kel',
        ),
        array(
            'header' => 'Nama Kecamatan',
            'name' => 'nama_kec',
        ),        
        array(
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'template' => '{update} ',
            'buttons' => array(
                'update' => array(
                    'url' => 'Yii::app()->createUrl("MasterFile/Kelurahan/update", array("id"=>$data->kode_kel))',
                ),
            ),
            'htmlOptions' => array('style' => 'width: 8%;text-align: center;'),
        ),
        array(
            'class' => 'bootstrap.widgets.TbButtonColumn',
            'template' => '{delete} ',
            'buttons' => array(
                'delete' => array(
                    'url' => 'Yii::app()->createUrl("MasterFile/Kelurahan/delete", array("id"=>$data->kode_kel))',
                ),
            ),
            'htmlOptions' => array('style' => 'width: 8%;text-align: center;'),
        )
    )
));
?>

<?php
     $this->widget('bootstrap.widgets.TbButton', array(
     'type' => 'success',
               'icon' => 'icon-plus-sign',
               'label' => 'Tambah Kelurahan',
               'url'=>  Yii::app()->createUrl('/MasterFile/Kelurahan/create'),
     'htmlOptions'=>array('style'=>'margin-top:20px'),
     ));
?>


